<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/Static/Css/reset.css" />
<link rel="stylesheet" type="text/css" href="/Static/Css/zh-cn-system.css" />
<link rel="stylesheet" type="text/css" href="/Static/Css/table_form.css" />
<script src="/Public/js/jquery.min.js"></script>
<script src="/Public/js/jquery.form.js"></script>
<script src="/Public/js/main.js"></script>
<script type="text/javascript" src="/Public/artDialog/jquery.artDialog.js?skin=default"></script>
<script type="text/javascript" src="/Public/artDialog/plugins/iframeTools.js"></script>
</head>
<body>

<script type="text/javascript" src="/Public/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/Public/ToolTip.js"></script>

<div class="subnav">
  <div class="explain-col" style="position: relative;">
    <form name="searchForm" id="searchForm" method="GET" action="">
      搜索：
      <input type="text" name="keyword" id="keyword" size="30" placeholder="请输入关键词"  value="<?php echo ($_GET['keyword']); ?>" class="input-text"  style="height:20px; width:120px; color:#999" />

      <select name="source" id="source" onchange="searchForm.submit()">
        <option value="0">请选择咨询方式</option>
        <?php $_result=get_source_list();if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["id"]); ?>" <?php echo selected($vo['id'],$_GET['source']);?>><?php echo ($vo["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
      </select>

      <input type="submit" value=" 搜索 " class="button" id="searchButton" />
    </form>
  </div>
</div>
<!--subnav-->
<div class="pad-lr-10">
  <form name="myform" id="myform" action="" method="post">
    <div class="table-list">
      <table width="100%" cellspacing="0">
        <thead>
          <tr>
            <th width="50" align="center">选择</th>
            <th align="center">录入时间</th>
            <th align="center">所属顾问</th>
            <th align="center">咨询方式</th>
            <th align="center">意向级别</th>
            <th align="center">详细级别</th>
            <th align="center">学员名称</th>
            <th align="center">所在地</th>
            <th align="center">课程项目</th>
            <th align="center">详细课程</th>
            <th align="center">联系电话</th>
            <th align="center">上次跟进</th>
            <th align="center">剩余天数</th>
            <th align="center">下次跟进</th>
            <th align="center">跟进次数</th>
            <th align="center" width="160">操作</th>
          </tr>
        </thead>
        <tbody  id="list">
          <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr id="list-<?php echo ($vo["id"]); ?>">
              <td align="center"><input type="checkbox" name="idArr[]" value="<?php echo ($vo["id"]); ?>"></td>
              <td align="center"><?php echo (date('Y-m-d H:i:s',$vo["create_time"])); ?></td>
              <td align="center"><?php echo (get_counselor_name($vo["user_id"])); ?></td>
              <td align="center"><?php echo (get_source_name($vo["source"])); ?></td>
              <td align="center"><?php echo (levelArr($vo["level"])); ?></td>
              <td align="center"><?php echo ($vo["level_text"]); ?></td>
              <td align="center"><?php echo ($vo["name"]); ?></td>
              <td align="center"><?php echo ($vo["address"]); ?></td>
              <td align="center"><?php echo (get_course_name($vo["course"])); ?></td>
              <td align="center"><?php echo ($vo["course_text"]); ?></td>
              <td align="center"><?php echo ($vo["phone"]); ?></td>
              <td align="center"><?php echo (date('Y-m-d H:i:s',$vo["talk_time"])); ?></td>
              <td align="center"><?php echo ($vo["talk_num"]); ?></td>
              <td align="center"><?php echo (date('Y-m-d H:i:s',$vo["talk_time"])); ?></td>
              <td align="center"><?php echo ($vo["talk_num"]); ?></td>
              <td align="center">
              </td>
            </tr><?php endforeach; endif; else: echo "" ;endif; ?>
        </tbody>
      </table>
      <div class="btn">
        <div id="pages"><?php echo ($page); ?></div>
         <input name="submit" id="checkall" type="button" class="button" value="全选/反选">
         <input name="submit" type="button" class="button" value="设为私有"  onclick="return owned();">
      </div>
    </div>
  </form>
</div>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(e) {


  //全反选
  $("#checkall").click(function(){
    $("input[name=idArr[]]").each(function(){
      if(this.checked == false)
        this.checked = true;
      else
          this.checked = false;
    });
  });

});



function owned() {
    art.dialog({
        content: '确定将所选择的学员设为私有的吗？',
        ok: function() {
            to_owned();
            return true;
        },
        cancelVal: '取消',
        cancel: true
    });
}

function to_owned() {
    var idArr = Array();
    var i = 0;
    var id;
    $("input[name='idArr[]']").each(function() {
        if (this.checked == true) {
            idArr[i] = $(this).val();
            i++;
        }
    });
    jQuery.get('/index.php/customer/owned/status/1', encodeURI('id=' + idArr), success, 'json');

    function success(data) {
        if (data.status == 1) {
            window.top.art.dialog({
                id: 'TNCICC',
                content: data.info,
                time: 1,
                icon: 'succeed'
            });
            setTimeout(function() {
              window.location.reload();
            }, 1000);
        } else {
            window.top.art.dialog({
                id: 'TNCICC',
                content: data.info,
                time: 1,
                icon: 'warning'
            });
        }

    }
}


</script>